#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef struct
{
    int last;
    int opposite;
} Node;

int find(Node *arr, int val)
{
    if (arr[val].last != val)
    {
        arr[val].last = find(arr, arr[val].last);
    }

    return arr[val].last;
}

int main(int argc, char const *argv[])
{
    vector<string> results;
    Node *nodes;
    char c;
    int t, n, m, x, y, l, r;
    int i, j, k, temp;
    cin >> t;
    for (i = 0; i < t; i++)
    {
        cin >> n >> m;
        nodes = new Node[n + 1];
        for (i = 0; i <= n; i++)
        {
            nodes[i].last = i;
            nodes[i].opposite = 0;
        }
        for (j = 0; j < m; j++)
        {
            cin >> c >> x >> y;

            if (c == 'Q')
            {
                if (x == y)
                {
                    results.push_back("In the same gang.");
                }
                else if (!nodes[x].opposite || !nodes[y].opposite)
                {
                    results.push_back("Not sure yet.");
                }
                else if (find(nodes, x) == find(nodes, y))
                {
                    results.push_back("In the same gang.");
                }
                else if (nodes[find(nodes, x)].opposite == find(nodes, y))
                {
                    results.push_back("In different gangs.");
                }
                else
                {
                    results.push_back("Not sure yet.");
                }
                continue;
            }

            if (nodes[x].opposite && nodes[y].opposite)
            {
                nodes[find(nodes, y)].last = nodes[x].opposite;
                nodes[find(nodes, nodes[y].opposite)].last = find(nodes, x);
            }
            else if (nodes[x].opposite)
            {
                nodes[y].last = nodes[x].opposite;
                nodes[y].opposite = x;
            }
            else if (nodes[y].opposite)
            {
                nodes[x].last = nodes[y].opposite;
                nodes[x].opposite = y;
            }
            else
            {
                nodes[x].opposite = y;
                nodes[y].opposite = x;
            }
        }
    }

    for (i = 0; i < results.size(); i++)
    {
        if (i)
            cout << "\n";
        cout << results[i];
    }

    return 0;
}
